//callback will be called when the user selects his location
function locationController(){


    this.humanFriendlyAddrs = function(lat, lng, callback) {
        
        var geocoder = new google.maps.Geocoder();
        var latlng = new google.maps.LatLng(lat, lng);
        
        geocoder.geocode({
            'latLng': latlng
        }, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) { 
                var res = new Array();
                //primi 5 risultati, o quelli presenti
                for (var i=0; i<5 && i<results.length; i++){
                    res.push(results[i].formatted_address);
                }
                //console.log(res);
                callback(res);
            } else {
                alert("Geocoder failed due to: " + status);
            }
        });
    }
    
}
